<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style>
        div {
            width: 80%;
            height: 80%;
            padding: 10%;
            position: relative;
        }

        #a {
            background: rgba(255, 0, 0, .6);
        }

        #b {
            background: rgba(0, 255, 0, .6);
        }

        #c {
            background: rgba(0, 0, 255, .6);
        }

        p {
            text-align: center;
        }

        .box {
            height: 500px;
            width: 800px;
            margin: 0 auto;
            margin-top: 100px;
           
            /*写在前面的背景图会在上面*/
            background-position: right bottom, left top;
            /*默认为left top*/
            background-repeat: no-repeat, repeat;
            /*默认为repeat*/
            background-size: 60% 100%, 20% 20%;
        }
    </style>
</head>

<body>
    <div class="box"></div>
    <div id="a">
        <p> this is a div</p>
        <div id="b">
            <p>this is b div</p>
            <div id="c">
                <p>this is c div</p>
            </div>
        </div>
    </div>
    <script src="./jquery.js"></script>
    <script type="text/javascript">
        var a = document.getElementById('a'),
            b = document.getElementById('b'),
            c = document.getElementById('c');

        //封装ie兼容函数，绑定事件  
        //obj为要绑定事件的元素，ev为要绑定的事件，fn为绑定事件的函数  
        function myAddEvent(obj, ev, fn) {

            if (obj.attachEvent) { //针对IE浏览器，事件前要加上"on"  
                obj.attachEvent('on' + ev, fn);
            } else { //针对FF与chrome  
                obj.addEventListener(ev, fn);
                //当为true时采用事件捕获，当为false采用事件冒泡  
                //程序员可以自己选择绑定事件时采用事件捕获还是事件冒泡。  
            }
        }

        myAddEvent(a, 'click', function () {
            console.log('this is a div');
        });
        myAddEvent(b, 'click', function () {
            console.log('this is b div');
        });
        /* myAddEvent(c, 'click', function () {
            console.log('this is c div');
            return false;
        }); */
        $("#c").on("click.vs",function(e){
            console.log("this is c div");
            //return false
            e.stopPropagation();
            
        })
    </script>
</body>

</html>